GenerativeComponents Help

Arguments

The Arguments for a function are listed in parenthesis. The type of each argument is normally written before each value. In the example below the function type is double, the function name is multiply and the arguments are two doubles number1 and number2.

double multiply(double number1, double number2)
{
	return number1*number2;
}

GenerativeComponents does not require that the type is given for any argument. Specifying the nature of the any input argument does however restrict the input which is often advantageous. If any of the arguments are arrays, the rank can be indicated using the appropriate number of sets of opening and closing square brackets after the Type.

In the following example unsortedNumbers is an array of type int.

int minimum(int[] unsortedNumbers)
{
	int min = 1000000;  // a very large number
	foreach (int num in unsortedNumbers)
	{
		if(num < min)
		{
			min = num;
		}
	}
	return min;
int list = {9, 3, 6, 34, 2, 10};
int lowestNumber = minimum(list);  // result = 2

Inputs are generally given specific names within the function, to distinguish them from variables outside of the function. This gives the user the opportunity to clarify, by appropriate naming, their role within the function.